package com.xbongbong.paas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

/**
 * @author 吴峰
 * @version v1.0
 * @date 2019/9/19 15:21
 * @since v1.0
 */
@Getter
public enum LogicalSymbolEnum {

    /**
     * 等于
     */
    EQUAL("equal", "=", "enum.logicalSymbol.memo.equal"),

    SUM("sum", "+", "enum.logicalSymbol.memo.sum"),

    LESS("less", "-", "enum.logicalSymbol.memo.less"),

    ;
    private String symbol;

    private String operator;

    private String memo;


    LogicalSymbolEnum(String symbol, String operator, String memo) {
        this.symbol = symbol;
        this.operator = operator;
        this.memo = memo;
    }

    public static LogicalSymbolEnum getBySymbol(String symbol) {
        for (LogicalSymbolEnum condition: values()) {
            if(condition.getSymbol().equals(symbol)){
                return condition;
            }
        }
        return null;
    }

    public String getMemo() {
        return I18nMessageUtil.getMessage(memo);
    }
}
